package net.lab1024.sa.admin.module.business.exam.controller;


import net.lab1024.sa.admin.module.business.exam.dao.*;
import net.lab1024.sa.admin.module.business.exam.domain.vo.BaseCountVo;
import net.lab1024.sa.admin.module.business.exam.domain.vo.ExamCountVo;
import net.lab1024.sa.admin.module.system.employee.dao.EmployeeDao;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class BaseCountController {

    @Resource
    private EmployeeDao employeeDao;

    @Resource
    private CourseDao courseDao;

    @Resource
    private QuestionsDao questionsDao;

    @Resource
    private ExamromDao examromDao;

    @Resource
    private ExamromaDao examromaDao;
    @Autowired
    private PaperDao paperDao;

    @GetMapping("/base_count")
    public ResponseDTO<BaseCountVo> baseCount() {
        /*
         * 1、统计用户数量
         * 2、统计课程数量
         * 3、统计试题数量
         * 4、统计试卷数量
         * 5、统计考试数量
         * */
        BaseCountVo baseCountVo = new BaseCountVo();
        baseCountVo.setUserNum(employeeDao.selectCount(null));
        baseCountVo.setCourseNum(courseDao.selectCount(null));
        baseCountVo.setQuestionNum(questionsDao.selectCount(null));
        baseCountVo.setPaperNum(paperDao.selectCount(null));
        baseCountVo.setExamNum(examromDao.selectCount(null));
        return ResponseDTO.ok(baseCountVo);
    }

    @GetMapping("/exam_count")
    public ResponseDTO<List<ExamCountVo>> examCount() {
        /*
         * 1、统计用户数量
         * 2、统计课程数量
         * 3、统计试题数量
         * 4、统计试卷数量
         * 5、统计考试数量
         * */

        List<ExamCountVo> list = examromaDao.examCount();

        return ResponseDTO.ok(list);
    }


}
